home *** CD-ROM | disk | FTP | other *** search
- function getScores(mode)
- {
- throbber.gotoAndStop("throb");
- xml = new XML();
- xml.ignoreWhite = true;
- var _loc2_ = undefined;
- switch(mode)
- {
- case "level":
- case "cheats":
- _loc2_ = _global.backendURL + "comms/getscores.comms.php?lId=" + lId + "&mode=" + mode;
- break;
- case "sex":
- case "age":
- case "fanOf":
- case "country":
- _loc2_ = _global.backendURL + "cache/leagues/" + mode.toLowerCase() + ".xml?";
- }
- if(_global.root.pId)
- {
- _loc2_ += "&pId=" + _global.root.pId;
- }
- _loc2_ += "&r=" + Math.random();
- xml.onLoad = gotScores;
- xml.load(_loc2_);
- }
- function gotScores(success)
- {
- if(success)
- {
- var _loc5_ = this.firstChild;
- var _loc4_ = undefined;
- best_txt.text = "";
- top10 = [];
- me = [];
- var _loc3_ = 0;
- while(_loc3_ < _loc5_.childNodes.length)
- {
- _loc4_ = _loc5_.childNodes[_loc3_];
- switch(_loc4_.nodeName)
- {
- case "top10":
- top10 = nodeToArray(_loc4_);
- break;
- case "me":
- me = nodeToArray(_loc4_);
- break;
- case "best":
- }
- _loc3_ = _loc3_ + 1;
- }
- if(_global.root.pId && me.length)
- {
- populateScores(me);
- findYou_btn._visible = true;
- }
- else
- {
- populateScores(top10);
- findYou_btn._visible = false;
- }
- switch(_loc5_.attributes.mode)
- {
- case "level":
- var _loc6_ = !lId ? "All Levels" : _global.root.levelData[lId].title;
- scoresFor_txt.htmlText = "Scores: " + _loc6_;
- break;
- case "country":
- scoresFor_txt.htmlText = "Average Scores: Country";
- break;
- case "sex":
- scoresFor_txt.htmlText = "Average Scores: Gender";
- break;
- case "age":
- scoresFor_txt.htmlText = "Average Scores: Age Group";
- break;
- case "band":
- scoresFor_txt.htmlText = "Scores: Fave Band";
- break;
- case "cheats":
- scoresFor_txt.htmlText = "Scores: Cheats";
- }
- }
- throbber.gotoAndPlay("throbOut");
- }
- function nodeToArray(node)
- {
- arr = [];
- i = 0;
- while(i < node.childNodes.length)
- {
- arr.push(node.childNodes[i].attributes);
- i++;
- }
- if(node.attributes.mypos)
- {
- arr.mypos = Number(node.attributes.mypos);
- }
- return arr;
- }
- function populateScores(arr)
- {
- var _loc5_ = 15;
- var _loc4_ = 0;
- for(var _loc6_ in highscores_mc)
- {
- if(highscores_mc[_loc6_] instanceof MovieClip)
- {
- highscores_mc[_loc6_].removeMovieClip();
- }
- }
- var _loc3_ = undefined;
- var _loc1_ = 0;
- while(_loc1_ < arr.length && _loc1_ < 10)
- {
- _loc3_ = highscores_mc.attachMovie("highscoresItem","hsi" + _loc1_,_loc1_);
- _loc3_._y = _loc4_;
- _loc3_.pos_txt.text = arr[_loc1_].pos;
- _loc3_.name_txt.text = !checkSwear(arr[_loc1_].name) ? "anonymous" : checkSwear(arr[_loc1_].name);
- _loc3_.score_txt.text = Format.number(arr[_loc1_].score);
- _loc4_ += _loc5_;
- if(arr.mypos !== undefined && arr.mypos + 1 == arr[_loc1_].pos)
- {
- _loc3_.gotoAndStop("you");
- }
- _loc1_ = _loc1_ + 1;
- }
- }
- function selectLevel(n)
- {
- lId = n;
- getScores("level");
- selectLevel_mc.gotoAndPlay("hideLevels");
- }
- swearArray = new Array("fuck","shit","cunt","fuk","kunt","phuk","phuck");
- checkSwear = function(mytext, peek)
- {
- findMe = swearArray;
- peek = 1;
- myTotal = 0;
- myWords = 0;
- while(myWords <= findMe.length - 1)
- {
- look = 0;
- while(look < mytext.length)
- {
- j = 0;
- fill = "";
- mySmall = mytext.substr(look,findMe[myWords].length).toLowerCase();
- wordSmall = findMe[myWords].toLowerCase();
- if(mySmall == wordSmall)
- {
- while(j < findMe[myWords].length - 2 * peek)
- {
- fill += "*";
- j++;
- }
- mytext = mytext.substr(0,look + peek) + fill + mytext.substr(look - peek + findMe[myWords].length);
- myTotal++;
- }
- look++;
- }
- myWords++;
- }
- return mytext;
- };
- lId = 0;
- if(_global.root.levels.lvl !== undefined)
- {
- lId = _global.root.levels.lvl;
- }
- else
- {
- lId = 0;
- }
- getScores("level");
- if(!_global.root.pId)
- {
- findYou_btn._visible = false;
- }
-